using System;

namespace HoustonCodingDojo1.Core
{
    public class AuthenticationService : IAuthenticationService
    {
        private readonly IUserRepository _userRepository;

        public AuthenticationService(IUserRepository userRepository)
        {
            _userRepository = userRepository;
        }

        public AuthenticationResult Authenticate(string id, string password)
        {
            if (_userRepository.AreCredentialsValid(id, password))
                return new AuthenticationResult(String.Empty, true);

            return new AuthenticationResult("Invalid credentials", false);
        }
    }
}